package edu.seu.shuai.exception;


import edu.seu.shuai.response.BasicRespCode;

public class MqException extends RuntimeException implements BasicRespCode {

    private final BasicRespCode respCode;

    public MqException(BasicRespCode respCode) {
        this.respCode = respCode;
    }

    public MqException(String message, BasicRespCode respCode) {
        super(message);
        this.respCode = respCode;
    }

    public MqException(String message, Throwable cause, BasicRespCode respCode) {
        super(message, cause);
        this.respCode = respCode;
    }

    public MqException(Throwable cause, BasicRespCode respCode) {
        super(cause);
        this.respCode = respCode;
    }

    public MqException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, BasicRespCode respCode) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.respCode = respCode;
    }

    @Override
    public String getCode() {
        return this.respCode.getCode();
    }

    @Override
    public String getMsg() {
        return this.respCode.getMsg();
    }
}
